feat(Instagram): Add Hide reshare button patch
#6303
+106
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removes the reshare button from both posts and reels.
This was quite the journey inside Instagram code. For some reason, the normal
parseFromJsonisn't used for media. Instead, a spaghetti-code like implementation of a json parser is used.TLDR, medias are received in 3 ways:
For the first 2 cases, the first fingerprint handles them. The 3rd is handled by the 2nd fingerprint. There is probably a single place which can handle all cases, however I wasn't able to find it after multiple hours.
The JSON parser deserialize the JSON object but instead of saving it into a class, it saves the media fields into a public hashmap, where they key of the map if the hashcode of the JSON field (eg
enable_media_notes_production(our flag for this patch) is stored with key-545107410in the map.The code is a mess, duplicated classes, objects with public fields passed as reference which gets modified, methods unused. Possibly this patch is easier with a patch which modifies the view, removing the button. However I'm not familiar with that type of patches. I added comments, please @LisoUseInAIKyrios improves them, let me know if any of this stuff can be simplified.
Side note, I have no idea why the flag which controls the reshare button visibility is called
enable_media_notes_production...